package com.rocksea.checkservice;

import android.content.Context;
import android.content.pm.PackageManager;
import android.support.v4.content.ContextCompat;

/**
 * Created by 吴志华 on 2017/5/4.
 * 检测权限的工具类
 */

public class PermissionsChecker {
    private Context mContext;

    public PermissionsChecker(Context context) {
        mContext = context;
    }
    public boolean lacksPermissions(String... permissions){
        for (String permission:permissions){
            if (lacksPermission(permission))
                return true;
        }
        return false;
    }
    private boolean lacksPermission(String permission){
        return ContextCompat.checkSelfPermission(mContext, permission) == PackageManager.PERMISSION_DENIED;
    }

}
